POV-Ray : Newsgroups : povray.general : Flower power : Re: Flower power Server Time
4 Aug 2024 02:21:17 EDT (-0400)
  Re: Flower power  
From: Dave Matthews
Date: 24 Oct 2003 09:25:01
Message: <web.3f9927d7a022f3b88062416c0@news.povray.org>
Mike Williams wrote:
>Wasn't it Patrick Elliott who wrote:
>
>> I would love to actually know how they got that StarrRose. :(
>
>If you feel strongly enough about it to go out and buy the book that
>they got the equation from, then perhaps you could let us know.
>
>Mike Williams
>Gentleman of Leisure
>
No need, someone already has the book.

What's going on here is a simple parametric curve, "doctored up" to look 3D.
 But we can do something similar in PovRay.

The radius varies according to a set function:  2 + sin(At)/2, creating an
"opened-up" rose.

The twist is that the angle, rather than simply proceeding counter-clockwise
around the circle, backs up on itself, NewT = t + Sin(Bt)/C, so that we
have the modified parametric equations:

x = r(t)cos(NewT), y = r(t)sin(NewT).

All of the shading is done by connecting the origin to the edge of the
curve, then shrinking and superimposing repeated copies of the image on
itself.

We can get one version of this by letting the vertical (y) component vary
according to r(t).

//Starr Rose For PovRay

#version 3.5;

#global_settings { assumed_gamma 1.0 }

camera {        angle 50
                right x*image_width/image_height
                location <0, 50, 0>
                look_at <0, 0, 0>
        }

light_source { <800, 1200, -500> color rgb <1, 1, 1> }

#macro Starr_Rose(A, B, C, N)

  #local Radius= function(Theta) {2 + sin(A*Theta)/2}
  #local AngleShift = function(Theta) {sin(B*Theta)/C}

  #local Angle = 0;

  #local Cycle = 2*pi;
  union {
  #while (Angle <= Cycle)
       #local X = Radius(Angle)*cos(Angle + AngleShift(Angle));
       #local Z = Radius(Angle)*sin(Angle + AngleShift(Angle));
       #local Y = 2 - Radius(Angle) ;
       cylinder { <0, 0, 0>, <X, Y, Z>, 0.05 }

    #local Angle = Angle + Cycle/N;

  #end
    }
#end



object { Starr_Rose(6, 18, 18, 500) texture { pigment { color rgb <1, 0, 0>
} }
                                    scale 5}

/////////////////End of Code

I'm guessing that one of you with more experience at POVRay can do up a
better version, but this gives the idea.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.